import { defineStore } from 'pinia'
import {computed, ref} from 'vue'
import axios from "axios";
import persist from "pinia-plugin-persistedstate";
export const userCounterStore = defineStore('counter', ()=> {
    const count = ref(100)
    const addCount = ()=> count.value++
    const subCount = ()=> count.value--
    const count1 = computed(()=> count.value + 100 )

    const channelList = ref([])
    const getList = async  ()=>{
        const { data: { data }} = await axios.get("http://geek.itheima.net/v1_0/channels")
        channelList.value = data.channels
    }
    return { count, addCount, subCount, count1, getList, channelList }
},{
    persist: true
})
